package cn.kgc.util;

import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 如果类中的某个属性值需要脱敏,在属性上使用此注解
 * @author wangyue
 * @version 1.0
 */
@JacksonAnnotationsInside
@JsonSerialize(using = SensitiveInfoSerializer.class)
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Desensitization {

    /**
     * 脱敏的数据类型
     */
    DesensitizationType desensitizationType();

    /**
     * 前多少位不遮照
     */
    int prefixLen() default 0;

    /**
     * 后多少位不遮罩
     */
    int suffixLen() default 0;
}
